package com.class5.springboot.frame.repo.real;

import com.class5.springboot.config.ResultEnum;
import com.class5.springboot.entity.TbXtAction;
import com.class5.springboot.frame.context.SuperServiceImpl;
import org.springframework.stereotype.Service;

@Service
public class JwtService extends SuperServiceImpl{

    public void roleRuthority(Long roleid, String url) {
        TbXtAction action = repo.getUnique("role_id",roleid,TbXtAction.class);
        if(action!=null){
            String role_url = action.getApiUrl();
            if(!url.contains(role_url)){
                throw new SecurityException(ResultEnum.LOGIN_ERROR_403);
            }
        }else{
            throw new SecurityException(ResultEnum.LOGIN_ERROR_403);
        }
    }
}
